/*
 * Copyright (c) 2017. 深圳掌控网络有限公司. All rights reserved.
 */

package com.yiqi.lottery.feature.lottery.presenter;

import android.text.TextUtils;
import com.suozhang.framework.framework.AM;
import com.yiqi.lottery.entity.bo.HomeBo;
import com.yiqi.lottery.entity.bo.LotteryHistoryBo;
import com.yiqi.lottery.entity.bo.LuckyHistoryBo;
import com.yiqi.lottery.entity.bo.OrderBo;
import com.yiqi.lottery.feature.lottery.contract.HomeContract;
import com.yiqi.lottery.feature.lottery.contract.LottoContract;
import com.yiqi.lottery.feature.lottery.dependencies.home.DaggerHomePresenterComponent;
import com.yiqi.lottery.feature.lottery.dependencies.lotto.DaggerLottoPresenterComponent;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;

import javax.inject.Inject;
import java.util.List;

/**
 *      LIJUWEN
 * @email yiyayiyayaoljw@gmail.com
 * @date 2017/4/11 9:31
 */
public class HomePresenter implements HomeContract.Presenter {

    private HomeContract.View mView;

    @Inject

    HomeContract.Model mModel;


    public HomePresenter(HomeContract.View mView) {
        this.mView = mView;
        DaggerHomePresenterComponent.create().inject(this);
    }

    @Override
    public void start() {

    }


    @Override
    public void getHomeData() {
        mModel.getHomeData().compose(mView.bindToLife()).subscribe(new Observer<HomeBo>() {
            @Override
            public void onSubscribe(Disposable d) {

            }

            @Override
            public void onNext(HomeBo s) {
                mView.showSuccess(s);
            }

            @Override
            public void onError(Throwable e) {
             mView.showError(e.getMessage());
            }

            @Override
            public void onComplete() {

            }
        });
    }
}
